package framework.graphics;

import javax.microedition.khronos.opengles.GL10;

public class MultistateTexture extends Presentation {

	private Presentation[] states;
	private int statesQuant;
	private int currentState = 0;
	
	public MultistateTexture(Presentation[] states) {
		this.states = states;
		this.statesQuant = states.length;
		this.height = states[0].getHeight();
		this.width = states[0].getWidth();
	}
	
	public void setCurrentState(int currentState) {
		if (currentState < 0 || currentState >= statesQuant) {
			this.currentState = 0;
		} else {
			this.currentState = currentState;
		}
	}
	
	@Override
	public void draw(float deltaTime, GL10 gl, float x, float y) {
		states[currentState].draw(deltaTime, gl, x, y);
	}

}
